<%@page contentType="text/html" %>
<%@page pageEncoding="UTF-8" %>

<%@taglib prefix="f" uri="http://java.sun.com/jsf/core" %>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html" %>
<%@taglib prefix="a4j" uri="http://richfaces.org/a4j" %>
<%@taglib prefix="rich" uri="http://richfaces.org/rich" %>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Goodwill - Недосдачи склада</title>
    <link rel="stylesheet" href="resources/css/main.css"/>
    <link rel="stylesheet" href="resources/css/stylesheet.css"/>
    <script type="text/javascript" src="resources/js/prototype.js"></script>
    <script type="text/javascript" src="resources/js/goodwill.js"></script>
    <style type="text/css">
        .t_green {
            font-weight: bold;
            color: darkgreen;
        }

        .t_red {
            font-weight: bold;
            color: darkred;
        }

        .filter_subpanel {
            margin-left: 4px;
            margin-right: 4px;
            white-space: nowrap;
            display: inline;
        }

        .rich-table-cell{
            font-size: 1.2em;
            text-align: center;
        }
    </style>
</head>
<body>
<f:view>
<jsp:include page="menu.jsp"/>
<jsp:include page="status.jsp"/>
    <h:form id="absenceReportForm">
    <h:panelGrid columns="6" cellpadding="5px" cellspacing="5px" style="text-align: center;">
        <h:outputText value="Дата: " styleClass="b"/>
        <h:outputText value=" c "/>
        <rich:calendar value="#{StoreChangesReport.beginDate}" locale="RU_ru"
                       datePattern="dd.MM.yyyy" style="width:80px;padding-left:4px;" id="calBegdate" required="true" requiredMessage="Необходимо выбрать временной период"/>
        <h:outputText value=" по "/>
        <rich:calendar value="#{StoreChangesReport.endDate}" locale="RU_ru"
                       datePattern="dd.MM.yyyy" style="width:80px;padding-left:4px;" id="calEnddate" required="true" requiredMessage="Необходимо выбрать временной период"/>
        <a4j:commandButton value="Выбрать" action="#{StoreChangesReport.reloadData}" reRender="tableForm"/>
    </h:panelGrid>
    </h:form>
<h:form id="tableForm">

    <h:outputText value="Общая сумма потерь: #{StoreChangesReport.totalSum}" style="font-size: 1.5em;"/>

    <br />
    <rich:dataTable value="#{StoreChangesReport.storeAnsenceModels}" var="item" align="center" rows="25" rowKeyVar="row" styleClass="full">

        <rich:column>
            <f:facet name="header">
                <h:outputText value="№"/>
            </f:facet>
            <h:outputText value="#{row + 1}. "/>
        </rich:column>

        <rich:column>
            <f:facet name="header">
                <h:outputText value="Код товара"/>
            </f:facet>
            <h:outputText value="#{item.goodCode}"/>
        </rich:column>

        <rich:column>
            <f:facet name="header">
                <h:outputText value="Количество заказов"/>
            </f:facet>
            <h:outputText value="#{item.ordersCount}"/>
        </rich:column>

        <rich:column>
            <f:facet name="header">
                <h:outputText value="Суммарное количество товара"/>
            </f:facet>
            <h:outputText value="#{item.goodCount}"/>
        </rich:column>
<        <rich:column sortable="true" sortBy="#{item.lossCost}">
            <f:facet name="header">
                <h:outputText value="Сумма потерь"/>
            </f:facet>
            <h:outputText value="#{item.lossCostAsString}"/>
        </rich:column>
        <f:facet name="footer">
            <rich:datascroller id="datascroller"/>
        </f:facet>
    </rich:dataTable>
</h:form>


</f:view>
</body>
</html>

